package com.gozap.sort.data;



/**
 * 插入排序的具体数据操作
 * 
 * @author yaoming
 * @date 2013-1-4 下午05:06:27
 * @since JDK1.6
 * @version 2.0.0
 */
public class IntegerData implements SortData {

	private int arr[] = { 4, 5, 3, 9, 8, 7, 98, 72, 10, 12, 8, 6, 20, 15, 60, 45, 2, 43, 11, 50 };

	@Override
	public void swap(int i, int j) {
		int temp = arr[i];
		arr[i] = arr[j];
		arr[j] = temp;
	}

	@Override
	public int length() {
		return arr.length;
	}

	@Override
	public boolean compare(int i, int j) {
		if (arr[i] > arr[j]) {
			return true;
		}
		return false;
	}

	public void print() {
		int len = length();
		for (int i = 0; i < len; i++) {
			System.out.print(arr[i] + " ");
		}
	}

}
